<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>JS-Java文档学习|Ficklelyh -Haloer的学习笔记</title>
         <meta name="keywords" content="JS, Haloer, MorePower, Linpower, HookFix课堂笔记, HookFix网络安全团队, Ficklelyh, JAVA, JAVA工程师, JAVA架构师,JSJAVA架构师 , JAVA语言, 学习笔记 ,Haloer JavaFix">
     <meta name="description" content="这是一个个人导航页面，包含常用网站链接和个人信息。HookFix课堂笔记 Linpower MorePower Haloer HookFix网络安全团队 Ficklelyh.github.io Ficklelyh/Ficktools - GitHub 农场主恨有钱人的个人空间-农场主恨有钱人个人主页 JSPHY HOOKFIX科技 JS分享笔记 Haloer分享笔记 JAVA课堂 JAVAHaloer JSJAVA">
     <meta name="author" content="HookFix网络安全团队JSJAVA">
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        header, footer {
            background: #333;
            color: #fff;
            text-align: center;
            padding: 1em;
        }
        main {
            flex: 1;
            padding: 20px;
        }
        h1, h3 {
            color: #333;
        }
        p {
            line-height: 1.6;
        }

        @media (max-width: 600px) {
            body {
                flex-direction: column;
            }
            main {
                padding: 10px;
            }
        }
    </style>
</head>
<body>
    <main>
        <h1>JAVA文档</h1>
        <h6>最后更新日期:2024-11-27----By.JS<br>QQ:3861497429</h6>
        <hr>
        <h2>substring</h2>
        <p>
            substring截取字符串<br>
            Result.substring(int beginIndex, int endIndex)<br>
            beginIndex -- 起始索引（包括）, 索引从 0 开始。<br>
            endIndex -- 结束索引（不包括）。<br>
            <img src="https://www.runoob.com/wp-content/uploads/2016/05/java-substring-20201208.png" style="width: 450px;height:300px;">
            <br>
            <code>
                <br>
                public class RunoobTest {<br>
                    public static void main(String args[]) {<br>
                        String Str = new String("This is text");<br>
                 
                        System.out.print("返回值 :" );<br>
                        System.out.println(Str.substring(4) );<br>
                 
                        System.out.print("返回值 :" );<br>
                        System.out.println(Str.substring(4, 10) );<br>
                    }
                }
                <br>
            </code>
            <code><br>
                返回值 : is text<br>
                返回值 : is te<br>

            </code>
        </p>

        <hr>
        <h2>replace</h2>
        <p>
            replace替换字符串<br>
            Result.replace(char searchChar, char newChar)<br>
            searchChar -- 原字符。<br>
            newChar -- 新字符。<br>
            <br>
            <code>
                <br>
                public class Main {<br>
                    public static void main(String args[]) {<br>
                        String Str = new String("Runoob");<br>
                
                        System.out.print("返回值 :" );<br>
                        System.out.println(Str.replace('o', 'T'));<br>
                
                        System.out.print("返回值 :" );<br>
                        System.out.println(Str.replace('u', 'D'));<br>
                    }<br>
                }<br>
                <br>
            </code>
            <code><br>
                返回值 :RunTTb<br>
                返回值 :RDnoob<br>

            </code>
            <code>
                实例2<br>
                package org.example;<br>
//replace(旧值,新值);   替换<br>
//replace(旧值,新值);   替换<br>
//replace(旧值,新值);   替换<br>
//replace(旧值,新值);   替换<br>
//replace(旧值,新值);   替换<br>
//replace(旧值,新值);   替换<br>
//replace(旧值,新值);   替换<br>

public class ReplaceStringTest {<br>
    public static void main(String[] args) {<br>
        //定义敏感字库<br>
        String [] arr = {"NMSL","NMD","sadas","sadad","CNM","fdvdxz","超xcbzf妮","csdfV"};<br>
        <br>
        String Talk = "你是不是";<br>
        <br>
        for (int i = 0; i < arr.length; i++) {<br>
            Talk = Talk.replace(arr[i],"和谐");<br>
        }<br>
        <br>
        System.out.println(Talk);<br>
    }<br>
}<br>
<br>
               

            </code>

        </p>

        <hr>
        <h2>length</h2>
        <p>
            length长度<br>
            Result.length()<br>

            <br>
        </p>
        <hr>
        <h2>reverse</h2>
        <p>
            reverse反转<br>
            Result.reverse()<br>
            abc  cba <br>
            <br>
        </p>
        <hr>
        <h2>append</h2>
        <p>
            append添加字符串<br>
            StringBuilder Result =new StringBuilder();<br>
            Result.append("aaa").append("aaa").append("aaa");<br>
            System.out.println(Result);<br>
            <br>
        </p>
        <hr>
        <h2>toUpperCase</h2>
        <p>
            toUpperCase转换为大写<br>
            Result.toUpperCase()<br>

            <br>
        </p>
        <hr>
        <h2>equals</h2>
        <p>
            equals比较<br>
            Result.equals()<br>
<code>
    package org.example;<br>
    <br>
import java.util.Scanner;<br>
<br>
public class StringBuilderDemo2 {<br>
    public static void main(String[] args) {<br>
        Scanner sc =new Scanner(System.in);<br>
        System.out.println("请输入一个字符串");<br>
        String str =sc.next();<br>
        <br>
//        StringBuilder sb =new StringBuilder();<br>
//        sb.append(str); //添加<br>
//        sb.reverse();  //反转<br>
//        System.out.println(sb);  //打印反转后的字符串<br>
        //反转键盘录入的字符串<br>
        String result = new StringBuilder().append(str).reverse().toString();<br>
        //比较equals<br>
        if(str.equals(result)){<br>
            System.out.println("当前字符串是对称字符串");<br>
        }else {<br>
            System.out.println("当前字符串不是对称字符串");<br>
        }<br>
    }<br>
}<br>

</code>
            <br>
        </p>
        <hr>
        <h2>builder</h2>
        <p>
           <code><br>
            package org.example;<br>

import java.util.Scanner;<br>


public class StringBuilderDemo1 {<br>
    public static void main(String[] args) {<br>
        //当我们在调用一个方法的时候,不需要用变量结束他的结果,可以继续调用其他方法<br>
        //整数类型 创建了一个变量Len <br> 
              //调用了方法 <br>
                          //进行截取字符串<br>
                                                  //进行替换字符串<br>
                                                                                        //获取长度
    int len = getString().substring(1).replace("A","Q").length();<br>
    //打印len<br>
    System.out.println(len);<br>
    <br>
        <br>
    }<br>

    public static String getString(){<br>
        Scanner sc =new Scanner(System.in);<br>
        System.out.println("请输入一个字符串");<br>
        String str = sc.next();<br>
        return str;<br>
    }<br>
}<br>
           </code>

        </p>
        <hr>
        <h2>链式编程</h2>
        <p>
            <code>
            public class StringBuilderTest {<br>
                public static void main(String[] args) {<br>
            //        创建对象<br>
                    StringBuilder sb = new StringBuilder();<br>
            
            //        添加字符串<br>
                    sb.append("aaa").append("bbb").append("ccc");<br>
                    System.out.println(sb);<br>
                    <br>
                    //再把StringBuilder变回字符串<br>
                    String str = sb.toString();<br>
                    System.out.println(str);<br>
                }<br>
            }
            </code>
            <br>
        </p>
        <hr>
        <h2>Array</h2>
        <p>
            Array数组<br>
            <code>

                //数组内存图<br>
public class Array {<br>
    public static void main(String[] args) {<br>
//        int a = 10;  //10赋值给了a<br>
//        int b = 20;  //20赋值给了b<br>
//        int c = a + b;<br>
//        System.out.println(c);<br>

<br>
//        int[] arr={1,2,3,4,5};<br>
//        System.out.println(arr);  //地址值 [I@16d3586<br>
<br>
        //两个数组指向同一个空间的内存图<br>
        //当两个数组指向同一个小空间时,其中一个数组对小空间中的值发生了改变<br>
        //那么其他数组再次访问的时候都是修改之后的结果了.<br>
        int[] arr1 = {11,22};   //arr1为第一个厕所<br>
        int[] arr2 = arr1;      //arr2为arr1的厕所  共用<br>
        System.out.println(arr1[0]);  //11<br>
        System.out.println(arr2[0]);  //11<br>
        arr2[0] = 33;                 //因为数据发生改变  数组arr1也就发生改变<br>
        System.out.println(arr1[0]);  //33<br>
        System.out.println(arr2[0]);  //33<br>
        <br>

    }<br>
}
            </code>
        </p>
        <hr>

    </main>


    
</body>
</html>